<template>
	<view class="page">
		<u-sticky>
			<u-tabs :list="tabbar" :is-scroll="false" :current="current" @change="change"></u-tabs>
		</u-sticky>
	    
		
		
		<waterfall :list="list" v-if="list.length" @go="go"></waterfall>
		
		
		
		
		<u-loadmore :status="initial.status" />
	</view>
</template>

<script>
	import loader from '@/common/loadPage.js';
	import waterfall from '@/components/waterfall'
	export default {
		mixins: [loader],
		components:{
			waterfall,
		},
		data() {

			return {
				tabbar: [
			     {
					name: '案例收藏',
					state:"cases"
				},  {
					name: '商品收藏',
					state:"goods"
				}],
				current: 0,
				list: [],
				initial: {
					geturl: "/user/collectList",
					parm: {
					   type:'cases', //cases 案例收藏，store 店铺收藏，goods 商品收藏
					},
					isPage: true
				},
				iselse:''
			}
		},
		
	
		async onLoad(options) {
			
			this.getGoods()
			
		},
		methods: {
			change(e){
				this.list = []; //清空list防止重付
				this.current=e;
				this.initial.page=1;
				this.initial.parm.type=this.tabbar[e].state
			
				
				this.getGoods()
			},
			go(e){
			  if(this.current==0){
				  uni.navigateTo({
				  	url:"/else/designSketch/detail?id="+e.object.id
				  })
				  return
			  }
			  if(this.current==1){
			  				  uni.navigateTo({
			  				  	url:"/pages/shop/detail?id="+e.object.id
			  				  })
							  return
			  }
			}
			
			
		}
	}
</script>


<style>
	
	.list{
		background: #fff;
	    width:700rpx;
		 margin: 20rpx auto;
		 padding: 20rpx;
	}
</style>
